﻿

-- 获取监视设备人员权限的详细信息
CREATE procedure [dbo].[JsdsbRyqx_Detail_Get]
@sblsh int,
@Jsdbh varchar(18)
as
-- 已存在
select vRyBzInfo.sfzh,xm,Jsd_Info.Jsdbh,Jsdm,bzmc qybmm,sfhbmd,case sfhbmd when 0 then '否' else '是' end sfhbmd_desc, 
sfkqfq,case sfkqfq when 0 then '否' else '是' end sfkqfq_desc,yxjcsj from vRyBzInfo
inner join SbDqyh_Info on (vRyBzInfo.sfzh=SbDqyh_Info.sfzh)
inner join Jsd_Info on(Jsd_Info.Jsdbh=SbDqyh_Info.Jsdbh)
where sblsh=@sblsh and Jsd_Info.jsdbh=@jsdbh


-- 变更
select Ry_Info.sfzh,xm,case zt when 0 then '新增' when 1 then '权限变更' else '删除' end zt_desc,zt
from Ry_Info
inner join vwFetchChangeUserAuthority on(Ry_Info.sfzh=vwFetchChangeUserAuthority.sfzh)
where vwFetchChangeUserAuthority.Jsdbh=@Jsdbh and vwFetchChangeUserAuthority.sblsh=@sblsh